<?
/* Code to add a database */
	include('config/config.php');
	include('config/funcs.php');
	global $CONFIG;
// connect to the database
	$link = mysql_connect($CONFIG['dbserver'], $CONFIG['dbuser'], $CONFIG['dbpass']);
echo "<html><head><title>add database</title></head><body>";


echo "<p>";

/* dbName is passed from index.html */
$dbName=$_POST['dbName'];

/* check to see if POST is empty */
if(isset($_POST['submit'])){
	/* if its not empty, add the database */
	echo "Successfully added ".$dbName."<br />";
	$dbQuery="CREATE DATABASE ".$dbName.";";
	mysql_query($dbQuery) or die("Something fucked up");
	echo mysql_error();
	echo "<a href=\"index.php\">Back</a>";
}
else {
	/* if it IS empty, ask the user again nicely */
	echo "Who are you adding to the database, again?";
	echo "<a href=\"index.php\">Back</a>";
}
echo "</p>";
echo "</body></html>"
?>
